<div class="dux-tools">
  <div class="bread-head">表单管理 <span class="small">可以添加或者修改表单功能</span> </div>
  <br>
  <div class="tools-function clearfix">
    <div class="float-left"> <a class="button button-small bg-main icon-list" href="__URL__"> 表单列表</a> </div>
    <?php if(model('user_group')->model_power('form','add')){ ?>
    <div class="button-group float-right"> <a class="button button-small bg-dot icon-plus dropdown-toggle"> 添加 <span class="downward"></span></a>
      <ul class="drop-menu pull-right">
        <li><a href="__APP__/form/add">添加表单</a></li>
      </ul>
    </div>
    <?php } ?>
  </div>
</div>
<div class="admin-main">
  <form action="__URL__/{$action}_save/time-<?php echo time() ?>-ajax-true" method="post" id="form" class="form-x dux-form form-auto">
    <div class="panel dux-box  active">
    <div class="panel-head"> <strong>{$action_name}表单</strong> </div>
    <div class="panel-body">
      <div class="form-group">
        <div class="label">
          <label>表单名称</label>
        </div>
        <div class="field">
          <input name="name" type="text" size="60" class="input" id="name" value="{$info.name}" reg="\S" msg="表单名称不能为空" />
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>表单名</label>
        </div>
        <div class="field">
           <input name="table" type="text" size="60" class="input" id="table" value="{$info.table}" reg="[a-zA-Z0-9_]" msg="表单名只能为英文数字和下划线" />
          <div class="input-note">前台调用标识</div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>内容排序</label>
        </div>
        <div class="field">
         <input name="order" type="text" class="input" size="20" id="order" value="{$info.order isset="id desc"}" reg="\S" />
          <div class="input-note"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>前台表单</label>
        </div>
        <div class="field">
        <?php if(!isset($info['display'])){ $info['display']=1; } ?>
          <div class="button-group button-group-small radio">
          <!--if:{$info['display']==1}-->
            <label class="button active">
              <input name="display" value="1" onclick="reception(1)"   checked="checked" type="radio">
              <span class="icon icon-check"></span> 是</label>
            <label class="button">
              <input name="display" value="0" onclick="reception(0)" type="radio">
              <span class="icon icon-times"></span> 否</label>
          <!--{else}-->
            <label class="button">
              <input name="display" value="1" onclick="reception(1)" type="radio">
              <span class="icon icon-check"></span> 是</label>
            <label class="button active">
              <input name="display" value="0" onclick="reception(0)" checked="checked" type="radio">
              <span class="icon icon-times"></span> 否</label>
          <!--{/if}-->    
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>前台提交返回</label>
        </div>
        <div class="field">
        <?php if(!isset($info['return_type'])){ $info['return_type']=0; } ?>
          <div class="button-group button-group-small radio">
          <!--if:{$info['return_type']==1}-->
            <label class="button active">
              <input name="return_type" value="1"   checked="checked" type="radio">
              <span class="icon icon-check"></span> JSON</label>
            <label class="button">
              <input name="return_type" value="0" type="radio">
              <span class="icon icon-times"></span> JS消息框</label>
          <!--{else}-->
            <label class="button">
              <input name="return_type" value="1" type="radio">
              <span class="icon icon-check"></span> JSON</label>
            <label class="button active">
              <input name="return_type" value="0" checked="checked" type="radio">
              <span class="icon icon-times"></span> JS消息框</label>
          <!--{/if}-->    
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>提交成功后消息</label>
        </div>
        <div class="field">
          <input name="return_msg" type="text" class="input" size="60" id="return_msg" value="{$info.return_msg isset="表单提交成功"}" reg="\S" msg="提交成功消息不能为空" />
          <div class="input-note">表单提交成功后返回的消息</div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>成功后返回地址</label>
        </div>
        <div class="field">
          <input name="return_url" type="text" class="input" size="60" id="return_url" value="{$info.return_url isset=""}"  />
          <div class="input-note">表单提交成功后返回的消息(留空返回当前表单)</div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>前台分页数</label>
        </div>
        <div class="field">
          <input name="page" type="text" class="input" size="20" id="page" value="{$info.page isset="10"}" reg="[0-9]" msg="分页数只能为数字" />
          <div class="input-note">前台列表显示的分页数</div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>前台列表条件</label>
        </div>
        <div class="field">
          <input name="where" type="text" class="input" size="60" id="where" value="{$info.where}" />
          <div class="input-note"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>独立模板</label>
        </div>
        <div class="field">
       <?php if(!isset($info['alone_tpl'])){ $info['alone_tpl']=1; } ?>
          <div class="button-group button-group-small radio">
          <!--if:{$info['return_type']==1}-->
            <label class="button active">
              <input name="alone_tpl" value="1"   checked="checked" type="radio">
              <span class="icon icon-check"></span> 是</label>
            <label class="button">
              <input name="alone_tpl" value="0" type="radio">
              <span class="icon icon-times"></span> 否</label>
          <!--{else}-->
            <label class="button">
              <input name="alone_tpl" value="1" type="radio">
              <span class="icon icon-check"></span> 是</label>
            <label class="button active">
              <input name="alone_tpl" value="0" checked="checked" type="radio">
              <span class="icon icon-times"></span> 否</label>
          <!--{/if}-->    
          </div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>前台模板</label>
        </div>
        <div class="field">
          <input name="tpl" type="text" class="input" size="60" id="tpl" value="{$info.tpl}" />
          <div class="input-note"></div>
        </div>
      </div>

    </div>
<?php if(model('user_group')->model_power('form','add')||model('user_group')->model_power('form','edit')){ ?>
    <!--普通提交-->
    <div class="panel-foot">
      <div class="form-button">
        <div id="tips"></div>
       <input name="id" type="hidden" value="{$info.id}" />
        <button type="submit" class="button bg-main">保存</button>
      </div>
    </div>
    <?php } ?>
  </form>
</div>
</div>
<script type="text/javascript">
reception({$info.display});
function reception(type){
	if(type){
		$('.reception').show();
	}else{
		$('.reception').hide();
	}
}
//提交表单
savelistform({addurl:"__URL__/add",listurl:"__URL__"});
</script>